package com.mdxl.controller;

import com.mdxl.Entity.TUser;
import com.mdxl.em.TUserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.Date;

@RestController
@RequestMapping("/em")
public class EMController {
    @Autowired
    private TUserDao dao;
    @PostMapping("/add")
    public void addTUser(){
        TUser user = new TUser();
        user.setAddTime(new Date());
        user.setIsdel(false);
        user.setLeftMoney(22.1F);
        user.setMoney(new BigDecimal(100.5));
        user.setRemark("备注");
        user.setState((byte)0);
        user.setUsername("张三");
        dao.save(user);
        System.out.println("添加后的主键:" + user.getId());
        System.out.println(user);
    }

}
